﻿using System.Linq;
using System.Net;
using System.ServiceModel.Syndication;

namespace $safeprojectname$.Model
{
    public class _TemplateSafeApplicationName_ItemMapper : ItemMapper
    {
        public _TemplateSafeApplicationName_ItemMapper(string rssFeed) : base(rssFeed)
        {

        }

        public override RssItem MapItem(SyndicationItem item)
        {
            var author = item.Authors.FirstOrDefault();
            var title = item.Title.Text;
            var content = HttpUtility.HtmlDecode(item.Summary.Text);
            var publishDate = item.PublishDate.DateTime;
            return new RssItem(item.Title.Text, content, author != null ? author.Email : "",publishDate);
        }
    }
}
